home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW Related / MPW Script Tips 1.1.1 / Sample Scripts / Quit•Mine < prev    next >
Encoding:
Text File  |  1991-08-16  |  2.7 KB  |  85 lines  |  [TEXT/MPS ]

  1. #----------------------------------------------------------------------------------------------------------------------------------------------------
  2. #    Quit•Mine
  3. #    MPW Shell Script
  4. #    Original by Stuart Davidson
  5. #    Changes by Gina Cherry • August 16, 1991
  6. #    Copyright:    © 1991 by Apple Computer, Inc., all rights reserved.
  7. #    
  8. #    Usage:    Quit•Mine is automatically executed by the Quit script when the user quits MPW
  9. #    
  10. #    Function: 
  11. #            Quit•Mine prompts the user to back up his/her files when exiting MPW, and executes
  12. #            the backup commands.
  13. #----------------------------------------------------------------------------------------------------------------------------------------------------
  14.         
  15. # Don't exit on error.        
  16.     Set Exit 0
  17.  
  18. # Set source and destination directories.  
  19. #    Note: these variables should be changed to correspond to the user's directories.
  20.     Set From "{Source}"
  21.     Set To "Backup:"
  22.  
  23. # Close help file; don't want to save changes.
  24.     Close -n "{MPW}Help Folder:Help" ∑∑ ≥ Dev:Null
  25.  
  26. #    Close all windows.  Request user confirmation before closing.
  27.     Close -a
  28.  
  29.     Save "{Worksheet}"
  30.  
  31.     Begin
  32.  
  33.     #    Eject floppy disk currently in drive 1.  
  34.         Eject 1
  35.  
  36.     # Prompt user to insert backup disk.
  37.         Confirm "Insert backup disk."
  38.     
  39.     # OK is selected.
  40.         If {Status}== 0
  41.     
  42.         # In this example, Backup generates duplicate commands for all text files in the source 
  43.         #    directory which do not exist in the destination directory, or which have been more modified 
  44.         #    more recently than the version in the destination.  Backup processes all subdirectories in 
  45.         #    the source directory recursively. All commands generated by Backup are redirected to the 
  46.         #    temporary file "{MPW}BackupTemp".  If the source or the destination is a floppy, Backup 
  47.         #    generates a command to eject your disk following the duplicate commands.  
  48.         #
  49.         #    Note: These options can be changed to suit the user's preference.  See the MPW Command 
  50.         #    Reference for more information on the Backup command.
  51.             Backup ∂
  52.                 -from "{From}" ∂
  53.                 -to "{To}" ∂
  54.                 -a -c -e -r -t TEXT  ∂
  55.             > "{MPW}BackupTemp"
  56.  
  57.         # If Backup is not successful, write error message, delete temporary file, and exit script.
  58.             If {Status} != 0
  59.                 Echo '### Backup failed.'
  60.                 Delete "{MPW}BackupTemp"
  61.                 Exit 1
  62.             End
  63.         
  64.         # Execute the commands generated by Backup, highlighting each command as it is executed.
  65.             DoIt "{MPW}BackupTemp" ≥ Dev:Null
  66.         
  67.         # If backup commands cannot be executed, write error message, delete temporary file, and 
  68.         #    exit script.
  69.             If {Status} != 0
  70.                 Echo '### Backup failed.'
  71.                 Delete "{MPW}BackupTemp"
  72.                 Exit 1
  73.             End
  74.             
  75.         #    Delete the temporary file.
  76.             Delete "{MPW}BackupTemp"
  77.         
  78.     #    Cancel is selected.
  79.         Else
  80.             Echo "# {0}: Backup cancelled."
  81.         
  82.         End
  83.     End ∑∑ "{Worksheet}"
  84.  
  85.